home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / util / Enumeration.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  2.4 KB  |  72 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)Enumeration.java    1.16 98/06/29
  3.  *
  4.  * Copyright 1994-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package java.util;
  16.  
  17. /**
  18.  * An object that implements the Enumeration interface generates a
  19.  * series of elements, one at a time. Successive calls to the
  20.  * <code>nextElement</code> method return successive elements of the
  21.  * series.
  22.  * <p>
  23.  * For example, to print all elements of a vector <i>v</i>:
  24.  * <blockquote><pre>
  25.  *     for (Enumeration e = v.elements() ; e.hasMoreElements() ;) {
  26.  *         System.out.println(e.nextElement());<br>
  27.  *     }
  28.  * </pre></blockquote>
  29.  * <p>
  30.  * Methods are provided to enumerate through the elements of a
  31.  * vector, the keys of a hashtable, and the values in a hashtable.
  32.  * Enumerations are also used to specify the input streams to a
  33.  * <code>SequenceInputStream</code>.
  34.  * <p>
  35.  * NOTE: The functionality of this interface is duplicated by the Iterator
  36.  * interface.  In addition, Iterator adds an optional remove operation, and
  37.  * has shorter method names.  New implementations should consider using
  38.  * Iterator in preference to Enumeration.
  39.  *
  40.  * @see     java.util.Iterator
  41.  * @see     java.io.SequenceInputStream
  42.  * @see     java.util.Enumeration#nextElement()
  43.  * @see     java.util.Hashtable
  44.  * @see     java.util.Hashtable#elements()
  45.  * @see     java.util.Hashtable#keys()
  46.  * @see     java.util.Vector
  47.  * @see     java.util.Vector#elements()
  48.  *
  49.  * @author  Lee Boynton
  50.  * @version 1.16, 06/29/98
  51.  * @since   JDK1.0
  52.  */
  53. public interface Enumeration {
  54.     /**
  55.      * Tests if this enumeration contains more elements.
  56.      *
  57.      * @return  <code>true</code> if and only if this enumeration object
  58.      *           contains at least one more element to provide;
  59.      *          <code>false</code> otherwise.
  60.      */
  61.     boolean hasMoreElements();
  62.  
  63.     /**
  64.      * Returns the next element of this enumeration if this enumeration
  65.      * object has at least one more element to provide.
  66.      *
  67.      * @return     the next element of this enumeration.
  68.      * @exception  NoSuchElementException  if no more elements exist.
  69.      */
  70.     Object nextElement();
  71. }
  72.